package com.esoon.controller;

import com.alibaba.fastjson.JSONObject;
import com.esoon.service.CsrServiceRecordService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @ClassName CsrServiceRecordController
 * @Description TODO 满意度写入功能
 * @Author 2020/10/2 17:26
 * @Version 1.0
 **/
@RestController
@RequestMapping(value = "/v1/CsrServiceRecord")
public class CsrServiceRecordController {
    private static final Logger logger;
    static {
        logger = LoggerFactory.getLogger(CsrServiceRecordController.class);
    }

    @Resource
    private CsrServiceRecordService csrServiceRecordService;

    @RequestMapping(value = "/updateStateByConnId",method = RequestMethod.POST)
    public String updateStateByConnId(@RequestBody JSONObject jsonParam){

        String connId=  jsonParam.getString("connId");
        String satisfaction=  jsonParam.getString("satisfaction");
        logger.info("invoking satisfaction insert interface ,the url = '/v1/CsrServiceRecord/updateStateByConnId',the requestParam : jsonParam = [{}]",jsonParam);
        try{
            return csrServiceRecordService.updateStateByConnId(connId, satisfaction);
        }catch (Exception e){
            logger.error(e.toString());
            return "500";
        }
    }

}
